<!DOCTYPE html>
<html>
    <head></head>
    <body>
        
        <p>点击按钮就可以执行 <em>displayDate()</em> 函数。</p>
        <button onclick="displayDate()">点击这里</button>
        <p id="demo"></p>

        <script>
        function displayDate(){
            document.getElementById("demo").innerHTML=Date();
        }
        
        </script>
    </body>
</html>